package com.hyy.demo.sample2;

import org.squirrelframework.foundation.fsm.annotation.StateMachineParameters;
import org.squirrelframework.foundation.fsm.impl.AbstractUntypedStateMachine;

/**
 * Created by hyygavin on 2017/12/9.
 */ // 2. 定义状态机的实现类,stateType:状态的类型,eventType:事件类型,contextType:上下文(共享数据)类型
@StateMachineParameters(stateType = String.class, eventType = FSMEvent.class, contextType = Integer.class)
public class StateMachineSample extends AbstractUntypedStateMachine {
    protected void fromTo(String from, String to, FSMEvent event, Integer context) {
        System.out.println("会话通过状态'" + from + "' 变更为 '" + to + "' 通过事件：'" + event +
                "' 上下文是  '" + context + "'.");
    }

    protected void onto(String from, String to, FSMEvent event, Integer context) {
        System.out.println("进入状态 \'" + to + "\'.");
    }

    protected void inner(String from, String to, FSMEvent event, Integer context) {
        System.out.println("进入内部状态 \'" + from + " : " + event.name() + "\'.");
    }

}
